package com.augmented.jellybean.util;

import java.util.ArrayList;

import android.app.Activity;
import android.app.ListActivity;
import android.content.Context;
import android.database.DataSetObserver;
import android.graphics.Bitmap;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.TextView;

import com.augmented.jellybean.R;

public class ListViewAdapter extends ListActivity implements ListAdapter {

	private Activity activity;
	private ArrayList<information> data;
	private static LayoutInflater inflater = null;
	public Bitmap image; 

	public ListViewAdapter(Activity a, ArrayList<information> d) {
		activity = a;
		data = d;
		inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	}

	public int getCount() {
		return data.size();
	}

	public Object getItem(int position) {
		return position;
	}

	public long getItemId(int position) {
		return position;
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		View vi = convertView;

		if(convertView == null)
			vi = inflater.inflate(R.layout.augmented_jellybean_list_screen, null);

		TextView title = (TextView)vi.findViewById(R.id.name); // name
		TextView address = (TextView)vi.findViewById(R.id.address); // address
		// OTextView type = (TextView)vi.findViewById(R.id.type); // type
		ImageView image = (ImageView)vi.findViewById(R.id.image); // image

		title.setText(data.get(position).getName());
		address.setText(data.get(position).getAddress());
		// type.setText(data.get(position).getTypeList());
		image.setImageBitmap(data.get(position).getIcon());

		return vi;
	}

	public int getItemViewType(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	public int getViewTypeCount() {
		// TODO Auto-generated method stub
		return 0;
	}

	public boolean hasStableIds() {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean isEmpty() {
		// TODO Auto-generated method stub
		return false;
	}

	public void registerDataSetObserver(DataSetObserver observer) {
		// TODO Auto-generated method stub

	}

	public void unregisterDataSetObserver(DataSetObserver observer) {
		// TODO Auto-generated method stub

	}

	public boolean areAllItemsEnabled() {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean isEnabled(int position) {
		// TODO Auto-generated method stub
		return false;
	}
}

